<template>
  <view class="container">
    <!-- <view class="nav">
      <view :class="['li',navindex == index? 'on':'']" v-for="(item, index) in nav" :key="index" @click='navChange(index)'>{{item.CLASS1}}<br>{{item.CLASS2}}</view>
    </view> -->
    <view class='title'>资兴市{{nav[navindex].CLASS2 || ''}}申请须知</view>
    <view class='session' v-html="nav[navindex].NOTICE"></view>
    <view class='flex'>
      <radio-group class="radio-group" @click="radioChange">
        <label class="radio">
          <checkbox :checked="disabled" class="checkbox"/>
          <text>以上内容本家庭全体成员已经认真阅读并知悉</text>
        </label>
      </radio-group>
      <view class='next' v-if="!disabled">下一步</view>
      <view class='next nextOK' @click='next' v-else>下一步</view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        disabled: false,
        navindex: 0,
        nav: []
      }
    },
    onLoad(options) {
      switch (options.index) {
        case '1':
          this.navindex = 1
          break;
        case '2':
          this.navindex = 2
          break;
        case '3':
          this.navindex = 3
          break;
        case '4':
          this.navindex = 4
          break;
        case '5':
          this.navindex = 0
          break;
      }
      let that = this;
      this.getNotice()
    },
    methods: {
      radioChange (e) {
        this.disabled = !this.disabled
      },
      next () {
        if (!this.disabled) {
          return false
        }
        uni.redirectTo({
          url: '../apply/index'
        })
      },
      getNotice() {
        uni.showLoading({
            title: '加载中'
        });
        this.$http.get('notice', {params: {CLASS1: '', CLASS2: ''}}).then(res => {
          this.nav = res.data;
          uni.setStorage({
            key: 'navdata',  
            data: this.nav[this.navindex]
          })
          uni.hideLoading()
        }).catch(err => {
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  background-color: #fff;
  box-sizing: border-box;
  display: block;
  justify-content: center;
  font-size: 30upx;
  color: #232323;
  padding: 0upx 46upx;
  line-height: 45upx;
  overflow-y: auto;
  padding-bottom: 220upx;
  .session{
    text-align: justify;
    line-height: 1.8;
  }
  .title{
    font-size: 40upx;
    font-weight: 500;
    display: block;
    margin: 40upx 0;
    text-align: center;
  }
  .nav{
    width: 100%;
    padding: 25upx 40upx;
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box;
    color: #1EC88B;
    background-color: #fff;
    font-size: 28upx;
    font-weight: 500;
    justify-content: space-evenly;
    border-bottom: solid 1upx #E6E6E6;
    text-align: center;
  }
  .nav .li{
    display: inline-block;
    flex: 1;
    line-height: 40upx;
    padding: 10upx 0;
    border: solid 1px #1EC88B;
    &:first-child{
      border-radius:6upx 0 0 6upx;
      border-left: solid 1px #1EC88B;
    }
    &:nth-child(2n){
      border-left:0;
      border-right: 0; 
    }
    &:last-child{
      border-radius:0 6upx 6upx 0;
      border-right: solid 1px #1EC88B;
    }
    &.on{
      background-color:  #1EC88B;
      color: #fff;
    }
  }
}
.flex .radio-group{
  text-align: center;
  font-size: 26upx;
  color: #1F1F1F;
  margin: 25upx 0 25upx 0;
}
.flex .radio-group checkbox{
  vertical-align: middle;
  margin-right: 6upx;
}
.flex .radio-group text{
  vertical-align: middle;
  display: inline-block;
}
.flex{
  background-color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}
.flex .next{
  font-size: 34upx;
  font-weight: 500;
  text-align: center;
  color: #979797;
  height: 98upx;
  line-height: 98upx;
  background:#DADBDD;
}
.flex .nextOK{
  background-color: #1EC88B;
  color: #fff;
}
</style>
